UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ndwhQvKEXN5E6CVXMx/uYay6iK8X9i4k4tpAfluw1Vc=' 
WHERE 
  key_id = '3fdd0937bfe417fde8f641a052e29ba98354506d3925dff452583396de71d3f2' 
  AND (
    token = 'ndwhQvKEXN5E6CVXMx/uYay6iK8X9i4k4tpAfluw1Vc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016