UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tmmqCahnYw21pLGioVqo7tvmcoTrJ9jY1rgYYTWGK+U='
WHERE
key_id = 'a95c8ab4b664124cd24fdacaec10422d6a4da9dbbe10acd30c8076d7119de3dd'
AND (
token = 'tmmqCahnYw21pLGioVqo7tvmcoTrJ9jY1rgYYTWGK+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)