UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D8SVtHoCJ0Yn+SpcnnoZVw6Ug6IWnzF0/yGLd6UOiK4=' 
WHERE 
  key_id = '162959300728bde6775b5143d3bcec5337023d2c3b277d1a5adb2e6166af4729' 
  AND (
    token = 'D8SVtHoCJ0Yn+SpcnnoZVw6Ug6IWnzF0/yGLd6UOiK4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040