UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KoszTt6gXI2sbtDEwJNnU9k2R2lBdIjKrwyBX0APGwg='
WHERE
key_id = 'a63af1acfdf745155560cec88c5941b3b524e2a58b02fecf8281ac264544cad1'
AND (
token = 'KoszTt6gXI2sbtDEwJNnU9k2R2lBdIjKrwyBX0APGwg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)