UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4L05S7VenhsKZPzwd8qszn9WUB5Pk6EYTaLMLWnETXY='
WHERE
key_id = 'a9ecccb6d93f43c709e422361df970ed9639f7f1a1ee49e7d200a5403fed71e7'
AND (
token = '4L05S7VenhsKZPzwd8qszn9WUB5Pk6EYTaLMLWnETXY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)