UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WzcFEH1+m9Dh2u6ofZra5OZWf1CpNus4dYRYEEYpCWs=' 
WHERE 
  key_id = 'ba9fbb690779d944a6452418b092550c9c737c8037cfa8ca85babf8627d95b44' 
  AND (
    token = 'WzcFEH1+m9Dh2u6ofZra5OZWf1CpNus4dYRYEEYpCWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034