UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gA2MjNwmkusAYNI188Hpv1xzTqeF/c6PVsBV4+aHwls=' 
WHERE 
  key_id = '42b1fdd1bc276a543bf65f0aa0b272e8570c4780d1e412645ac5db732b88c283' 
  AND (
    token = 'gA2MjNwmkusAYNI188Hpv1xzTqeF/c6PVsBV4+aHwls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045