UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nbPWBxJrWQEg3CFbIxFz92djwAkUk3rTxK1Ax52yRV0='
WHERE
key_id = '4222d36c98111d0d6514ffc240e299fc3ec693ce9bf6c6da7d32067358e0a919'
AND (
token = 'nbPWBxJrWQEg3CFbIxFz92djwAkUk3rTxK1Ax52yRV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)