UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x18CnTrh2uE9U1vwfbSILqlAot4oeJFPjD80ehtviv0='
WHERE
key_id = '072b389ca4704a21c364636f3efc2c191b731b9d672141b3d62516d691da6846'
AND (
token = 'x18CnTrh2uE9U1vwfbSILqlAot4oeJFPjD80ehtviv0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)