UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y3R5vSktos59l4VXbqkGrWD1QxGtRjgZn7B9s/PHov8='
WHERE
key_id = 'a09a61ceffe4fab791e940caa369e30262ffae6aa4fd863dfa1178ffa651d225'
AND (
token = 'Y3R5vSktos59l4VXbqkGrWD1QxGtRjgZn7B9s/PHov8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)