UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U5f/c46etAIaH4mlFE7bkepslgsppDqU+EFzFJZ0Tzk='
WHERE
key_id = '2baed88bb93cc79a9950a29ab622543c5a6711df057ab14d0781c56e8228b1a5'
AND (
token = 'U5f/c46etAIaH4mlFE7bkepslgsppDqU+EFzFJZ0Tzk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)