UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i0rdeiPXX1HAWHQTs1ybgPfHEkl2USIi8TzsDwez5aI='
WHERE
key_id = 'f102586b46bc9e4410784dbe9396e628789480c79d9737451b0c6d96b3ecb25c'
AND (
token = 'i0rdeiPXX1HAWHQTs1ybgPfHEkl2USIi8TzsDwez5aI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)