UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IiYh30kgDT4a+ok0G0+DKFmCqQ3c2L1ko3U8r0colUY='
WHERE
key_id = '2130e80b44db1473d30740e82f047e8033a9efa913d92b9501b54e587b8be67d'
AND (
token = 'IiYh30kgDT4a+ok0G0+DKFmCqQ3c2L1ko3U8r0colUY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)