UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lP2PiMPm33XqmoPNdw4HiHB27pHqiGFq2OElh8R5Km8='
WHERE
key_id = '90b556f152ce040151feec3fb9328917dd6075fcfda8056e4144526e903a70b8'
AND (
token = 'lP2PiMPm33XqmoPNdw4HiHB27pHqiGFq2OElh8R5Km8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)