UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZrNy3l+3xg+FkWw6hp04s6TwxEp88vDOWQv91yedLg0='
WHERE
key_id = 'b00b3fc40cdabdbc85391da517cb906ffa17d1926cf8c2911d24a728950f93d8'
AND (
token = 'ZrNy3l+3xg+FkWw6hp04s6TwxEp88vDOWQv91yedLg0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)