UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6JfKy3QdDjxxGbBm2FOCznEHf4FM6/QDagQI2jZ4fzs='
WHERE
key_id = 'e8e5ba51486745e91e4d6d94e2b2b8a8efe754c9b29071291c009a17104ce59c'
AND (
token = '6JfKy3QdDjxxGbBm2FOCznEHf4FM6/QDagQI2jZ4fzs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)