UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P/P7xnUohqhAKW2MYHfd9EtyBdt3XW22phG8kZeDggs='
WHERE
key_id = 'ee505ba36313f9edb48fb1592eeae03d627c47e94c1a32721375ca7158f476c2'
AND (
token = 'P/P7xnUohqhAKW2MYHfd9EtyBdt3XW22phG8kZeDggs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)