UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7H+wSmzlxsKrbk+oZiDm7Q4+dnAxqDRsQLJ+VGppqGs=' 
WHERE 
  key_id = '57d5238564849d08a5de62c638f9e573219644cbbcadafe07f9f3fb776d02694' 
  AND (
    token = '7H+wSmzlxsKrbk+oZiDm7Q4+dnAxqDRsQLJ+VGppqGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028