UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KWO7PoHe12iduwQC3F8/NTi0vEG7CwRvvZU5u93Kbwc='
WHERE
key_id = '50c891aab769213f5b61d05e8ad8ea9b58c2860cdf5b2ceb615505001b102938'
AND (
token = 'KWO7PoHe12iduwQC3F8/NTi0vEG7CwRvvZU5u93Kbwc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)