UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gXsk/PhGX9+2UUYrmWzqJ5UgarbWxiOus026fOdjPo8='
WHERE
key_id = 'a18e32fdfffac95cb17898e0b8c44955e18fe1c3e8b788961c30fbb448bfc68e'
AND (
token = 'gXsk/PhGX9+2UUYrmWzqJ5UgarbWxiOus026fOdjPo8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)