UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BVw3xaWwz89+yJguTzjM+sJqnhwvZp3M+0rIDF75OIQ=' 
WHERE 
  key_id = '203c41d4b958cb626b29dde6de6aad7229e26a5c0268b277fbd24e640a941cf7' 
  AND (
    token = 'BVw3xaWwz89+yJguTzjM+sJqnhwvZp3M+0rIDF75OIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044