UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6kqs8YjCVDNoXVM8dn+XbDBANhbiLMRx0QJq6T44Nj8='
WHERE
key_id = '82d68c21914603da94cac91edceeb67e9e9c6b21fcb09f21bf96de5a67b729e0'
AND (
token = '6kqs8YjCVDNoXVM8dn+XbDBANhbiLMRx0QJq6T44Nj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)