UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9PNi01AqKEgDOJ2MgF3hXYdIxL1AzJ8wdmKsc4sTCZM='
WHERE
key_id = '65dd24ce08a851c411a3eb64e3dfa51db121479ec755dfbc1a0938c4fe850a6f'
AND (
token = '9PNi01AqKEgDOJ2MgF3hXYdIxL1AzJ8wdmKsc4sTCZM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)