UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i0fW2qe50+iw4mtqDcSSjK5hl3gPWAw7qlcP6J12bQs='
WHERE
key_id = 'a7fb4e8dd54e56ae96baf529f478ef851028d22764a56358f6ac13c371cffac7'
AND (
token = 'i0fW2qe50+iw4mtqDcSSjK5hl3gPWAw7qlcP6J12bQs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)