UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tn9FzaqXZHiQtnu9/qGZ9X6bBsrJwUwtofCZandrYXY=' 
WHERE 
  key_id = 'a85bf2b19f9b453a25cf13d91c516c151f4eb0ab50fb790b86c9de3deeba5373' 
  AND (
    token = 'tn9FzaqXZHiQtnu9/qGZ9X6bBsrJwUwtofCZandrYXY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046