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