UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vCZgGj5fV0Xwjk0L5uab77fANiZ6ggXgGP+1qSK9Eto=' 
WHERE 
  key_id = 'c654708d50b8cefadde15bbfec18f280c2ee1122133d3ca1cc7a407c740a78bf' 
  AND (
    token = 'vCZgGj5fV0Xwjk0L5uab77fANiZ6ggXgGP+1qSK9Eto=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032