UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EHIs2f+G6TOLrFYi0UBd0Kyagm1+U1NHU1MHffa9jtw='
WHERE
key_id = 'ae39aa8a58cde969663a1ccea9e43a1cee9a791cdd12a0836e0b26f5a9ebee78'
AND (
token = 'EHIs2f+G6TOLrFYi0UBd0Kyagm1+U1NHU1MHffa9jtw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)