UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VApYLIp3vGVzrnPdbIjw3lbP4rZnr5nBfJ1g4cmluZg='
WHERE
key_id = 'c013447b02a6c4919013967793ef1a01217f3f9ab0ba0f637fdf0ce45504660c'
AND (
token = 'VApYLIp3vGVzrnPdbIjw3lbP4rZnr5nBfJ1g4cmluZg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)