UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9BSwuQ5BY1VHwIc8yrtdUogvWnew9qJ1PQNSIQg48U0='
WHERE
key_id = '3649a20b2b7ae06e6e50113204b43ff2c0bb159e1ba219fc7f69ee8b386ba0dd'
AND (
token = '9BSwuQ5BY1VHwIc8yrtdUogvWnew9qJ1PQNSIQg48U0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)