UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XCeSnNZpx3NgreEdr3bh2gcZNWGmhg6sxIINQbT0ko4='
WHERE
key_id = '19b5d71729f3ce931049093dfd386326d4cb825860128cb260cd124e404ce2d7'
AND (
token = 'XCeSnNZpx3NgreEdr3bh2gcZNWGmhg6sxIINQbT0ko4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)