UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B9sL5iwYuJiBeCoDSYLgKC+UCm0AFBZCmkwvoDRj4o0='
WHERE
key_id = 'ecc3ebf00a4271321d046dd8e4cbb28084cfcbca76204b8463310cf41d943c90'
AND (
token = 'B9sL5iwYuJiBeCoDSYLgKC+UCm0AFBZCmkwvoDRj4o0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)