UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W8exkiw2KkKVwAJkF2s5CjkSktCiOc5DMXxVNxFaZgE='
WHERE
key_id = '2bd178675cb56ccd66f575bc2a46903119b785e0f92d0c40d71cd2abae5d2775'
AND (
token = 'W8exkiw2KkKVwAJkF2s5CjkSktCiOc5DMXxVNxFaZgE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)