UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6gJwt5V6CWzUHVpjHlxf3NqQ1Y4Y0wFdX602WICTNpQ='
WHERE
key_id = '19e575fd7d4ce986492e8e64fa9ec8e4760ccea9e1045621f65db09b77cb51df'
AND (
token = '6gJwt5V6CWzUHVpjHlxf3NqQ1Y4Y0wFdX602WICTNpQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)