UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A2ZHGOBMVM80UA0Y5o0eqGHvKIdFSXL/5t/pKEyBWH4='
WHERE
key_id = 'dd8172dedecf4c288e87ebbe0ade57503d81630fa6348a8175eb0edc30da7a2d'
AND (
token = 'A2ZHGOBMVM80UA0Y5o0eqGHvKIdFSXL/5t/pKEyBWH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)