UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hSVgTNUuZkParnogl3vRZOHK+jYuvUi7KqW62hCRAqA=' 
WHERE 
  key_id = '116b9d5d2834c174cd269bfc0ae2e12be2e3d70ab03e28078fd2bbf2d2682061' 
  AND (
    token = 'hSVgTNUuZkParnogl3vRZOHK+jYuvUi7KqW62hCRAqA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040