UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ot23c3b5DEx7FzfMG54pDbr45Mvof6cw/CMGZy8qqRo='
WHERE
key_id = '65cf6fdcc9f70deb194f87748a96683125cbef41ffe52a9b20676a71baca5d73'
AND (
token = 'ot23c3b5DEx7FzfMG54pDbr45Mvof6cw/CMGZy8qqRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)