UPDATE
lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 300,
token = 'L9C2A14weamrJIbUhrceEbzTP6KfCQEL9XelX7YVJ9s='
WHERE
key_id = '6134896b73daaaf23bc43d4e8b2b704bf6cbc8132326c93648a3b2f2f60f6b6c'
AND (
token = 'L9C2A14weamrJIbUhrceEbzTP6KfCQEL9XelX7YVJ9s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)