UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u3AOeehVT6mkh+fYgXP84bjob2JxQiBaOdptg8yJMf4=' 
WHERE 
  key_id = 'b008a3f60075a72c0f1b120d53f5d68b72aa201303a3eed9035a18f295ef8185' 
  AND (
    token = 'u3AOeehVT6mkh+fYgXP84bjob2JxQiBaOdptg8yJMf4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030